// 判断坐标点位是否再区域坐标范围内
export function checkPointInPolygon(point, polygon) {
	var intersectCount = 0;
	for (var i = 0, len = polygon.length; i < len; i++) {
		var p1 = polygon[i];
		var p2 = polygon[(i + 1) % len];
		if (point[1] < Math.min(p1[1], p2[1]) || point[1] > Math.max(p1[1], p2[1])) {
			continue;
		}
		if (point[1] === p1[1] && point[1] === p2[1]) {
			continue;
		}
		var x = (point[1] - p1[1]) * (p2[0] - p1[0]) / (p2[1] - p1[1]) + p1[0];
		if (x > point[0]) {
			intersectCount++;
		}
	}
	return intersectCount % 2 === 1;
}